package com.itheima.controller;

import com.itheima.pojo.User;
import com.itheima.service.imple.config.AppConfig;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

@Controller
public class UserController {
    @RequestMapping("/getUserId")
    public void getUserId(HttpServletRequest request) {
        String userid = request.getParameter("userid");
        System.out.println("userid=" + userid);
    }

    @RequestMapping("/getUserNameAndId")
    public void getUserNameAndId(String username, Integer id) {
        System.out.println("username=" + username+",id=" + id);
    }
    @RequestMapping("/registerUser")
    public void registerUser(User user) {
        String name = user.getName();
        String password = user.getPassword();
        System.out.println("name=" + name);
        System.out.println("password=" + password);
    }
    @RequestMapping("/findOrderWithUser")
    public void findOrderWithUser(User user) {
        String username = user.getName();
        String orderId = user.getOrder().getOrderId();
        System.out.println("username=" + username+",orderId=" + orderId);
    }
}
